/**
 * RenweiWu
 * PubTerminalSevice.java
 * 2017年8月27日
 * PubTerminalSevice
 * TODO
 * 
 */
package com.etrans.web.gps.business.base.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.etrans.web.gps.base.service.BaseService;
import com.etrans.web.gps.business.base.domain.PubTerminal;
import com.etrans.web.gps.common.page.PageVo;

/**
 * @Description:TODO
 * @author RenweiWu
 * @date 2017年8月27日
 * @ClassName:  PubTerminalSevice  
 * @param:   
 */
@Service
public class PubTerminalSevice extends BaseService{
	
	public boolean  addPubTerminal(PubTerminal terminal){
		boolean result = false;
		if(this.insert("pubTerminalMapper.addPubTerminal",terminal)==1){
			 result = true;
		};
		return result;
	}
	
	public PageVo  queryPubTerminal(Map<String,Object> map){
		PageVo vo = new PageVo();
		List<PubTerminal> list = this.selectList("pubTerminalQuery.queryPubTerminalBypage",map);
		int count = this.selectOne("pubTerminalQuery.queryPubTerminalcount", map);
		vo.setRows(list);
		vo.setTotal(count);
		vo.setPage((Integer)map.get("page"));
		return vo;
	}
	
	public boolean deletepubTerminal(int id){
		boolean result = false;
			Map<String,Object> map =new HashMap<String,Object>(0);
			map.put("id",id);
			this.delete("pubTerminalMapper.deletePubTerminal",map);
			result =true;
		return result;
	}
	
	
	public boolean updatePubTerminal(PubTerminal terminal){
		boolean result = false;
			this.delete("pubTerminalMapper.updatePubTerminal",terminal);
			result =true;
		return result;
	}
	
	
	public PubTerminal  queryOneById(int id){
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("id", id);
		return this.selectOne("pubTerminalQuery.queryPubTerminalById",map);
	}
}
